#!/bin/bash
sudo mhwd -i pci video-hybrid-intel-nvidia-450xx-prime -f
sudo rm -rf /etc/X11/xorg.conf.d/90-mhwd.conf
sudo cp -i optimus.conf /etc/X11/xorg.conf.d
sudo rm /etc/modprobe.d/mhwd-gpu.conf
sudo rm /etc/modprobe.d/mhwd-nvidia.conf
sudo cp -i nvidia.conf /etc/modprobe.d
sudo cp -i nvidia-drm.conf /etc/modprobe.d
sudo cp -i optimus.desktop /usr/local/share
sudo ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop
sudo ln -s /usr/local/share/optimus.desktop /etc/xdg/autostart/optimus.desktop
echo "Now please reboot your PC"
